﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using BCDto.Common.Solution.WebsiteSolution;
using BCDto.Common.Solution.WebsiteSolutionItem;
using BCService.Common.Solution.WebsiteSolution;
using BCService.Common.Solution.WebsiteSolutionItem;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860

namespace BCTMSRESTful.Controllers.Anonymous
{
    [Route("api/v1/[controller]")]
    [ApiController]
    public class SolutionController : BCTMSRESTfulAPIController
    {
        private readonly IWebsiteSolutionService websiteSolutionService;
        private readonly IWebsiteSolutionItemService websiteSolutionItemService;

        public SolutionController(IWebsiteSolutionService websiteSolutionService, IWebsiteSolutionItemService websiteSolutionItemService)
        {
            this.websiteSolutionService = websiteSolutionService;
            this.websiteSolutionItemService = websiteSolutionItemService;
        }

        /// <summary>
        /// 获取官网解决方案列表。
        /// </summary>
        /// <response code="200">返回官网解决方案列表</response>
        /// <returns></returns>
        [HttpGet]
        [ProducesResponseType(typeof(IEnumerable<WebsiteSolutionViewDto>), 200)]
        [AllowAnonymous]
        public IActionResult Get()
        {
            return this.Ok(this.websiteSolutionItemService.GetList());
        }
    }
}
